﻿using System;
using System.Linq;
using Lyricsgrabber.Core.Tags;
using Lyricsgrabber.Core.Tags.APE;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Lyricsgrabber.Core.Test
{
  [TestClass]
  public class APETagTest
  {
    [TestMethod]
    public void TestApeTag()
    {
      Tag tag = new ApeTag(@".\Resources\APE\Ape only metadata.ape");

      Assert.IsTrue(tag.Metadata.Any(d => d.Type == MetadataType.Title));
      Assert.AreEqual("Invisible Walls", tag.Metadata.First(d => d.Type == MetadataType.Title).Value);

      Assert.IsTrue(tag.Metadata.Any(d => d.Type == MetadataType.Album));
      Assert.AreEqual("Invisible Walls", tag.Metadata.First(d => d.Type == MetadataType.Album).Value);

      Assert.IsTrue(tag.Metadata.Any(d => d.Type == MetadataType.Artist));
      Assert.AreEqual("Destination's Calling", tag.Metadata.First(d => d.Type == MetadataType.Artist).Value);

      IMetadata lyrics = tag.Metadata.FirstOrDefault(d => d.Type == MetadataType.UnsyncedLyrics);

      Assert.IsNotNull(lyrics);
      Assert.AreEqual(@"Darkness flows around us 
In this vanity we're passing by 
Drawing fancy lines on our 
Empty walls inside 

Chiming bells of decay 
We cannot defy 
Are hunting for more 
To numb the tears we cry 
Timeless is the dawn and the setting sun 
", lyrics.Value);
    }
  }
}
